﻿using System;
using Castle.Windsor;

namespace FoodBank.Infrastructure.IoC
{
    public static class WindsorContainerFactory
    {
        private static IWindsorContainer _container;
 
        public static IWindsorContainer Container(Action<IWindsorContainer> installerDelegate)
        {
            if(_container == null)
            {
                var container = new WindsorContainer();
                
                installerDelegate(container);

                _container = container;
            }
            return _container;
        }
    }
}
